package br.com.truta.bd;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class DBUtils {

	private DBUtils() {
		super();
	}

	public static final void close(Connection connection) {
		if (connection != null) {
			try {
				connection.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public static final void close(Statement statement) {
		if (statement != null) {
			try {
				statement.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public static final void close(ResultSet rs) {
		if (rs != null) {
			try {
				rs.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public static final void close(ResultSet rs, Statement statement, Connection connection) {
		close(rs);
		close(statement);
		close(connection);
	}

	public static final void close(Statement statement, Connection connection) {
		close(statement);
		close(connection);
	}

	public static final void close(ResultSet rs, Statement statement) {
		close(rs);
		close(statement);
	}

}
